package com.heima.admin.controller.v1;

import com.heima.admin.service.UserAuthService;
import com.heima.model.admin.dtos.AuthDto;
import com.heima.model.admin.dtos.AuthPageReqDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用户身份审核
 * @author yangkexuan
 * @className UserAuthController
 * @date 2023/8/2 15:41
 * @description
 */
@RestController
@RequestMapping("/api/v1/auth")
public class UserAuthController {

    @Autowired
    private UserAuthService userAuthService;

    /**
     * 用户身份审核
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public ResponseResult userAuth(@RequestBody AuthPageReqDto dto){
        return userAuthService.userAuth(dto);
    }

    /**
     * 通过审核
     * @param authDto
     * @return
     */
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDto authDto){
        Long id = Long.valueOf(authDto.getId());
        return userAuthService.authPass(id);
    }

    /**
     * 审核失败
     * @param authDto
     * @return
     */
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDto authDto){
        return userAuthService.authFail(authDto);
    }
}